*******************************************************
* Lyle 05 Jan 11: 						              *
*	-this program serves as a base shell for all	  *
*	 stata do files					                  *
*******************************************************


********************************
* Standard Stata Configuration *
********************************
clear all
set mem 999m
capture log close
set logtype text
cap cd "C:\Users\ejm5\Google Drive\2016_Research\Unemployment_MILEX"
cap cd "C:\Users\Jordan.Becker\Desktop\GD\2016_Research\Unemployment_MILEX"
cap cd "\\usnatonetapp01.eur.state.sbu\profiles\beckerjm\Desktop\2016_Research\Unemployment_MILEX"
log using "log\correlates_table2.log", replace


*********************
* Prepare Variables *
*********************
use "dta\2016_02_09_uem", clear
sort ccode year
xtset ccode year


********************
* Analyze the Data *
********************
set more off
sort ccode year
xtset ccode year


*NEW FIGURE 1: BIVARIATE CORRELATION BETWEEN O&M AND ISAF CONTRIBUTIONS/CAPITA*
#delimit;
pwcorr operating isaf_troops_capita isaf_troops_gdp, star(1);

reg operating isaf_troops_capita;

reg operating isaf_troops_gdp;

xi:xtpcse operating isaf_troops_capita , pairwise rhotype(dw);
outreg2 using output\Figure4_isaf, bdec(3) tdec(3) e(rmse) replace;


#delimit;
preserve;
collapse milburden operating personnel equipment infrastructure atlanticism idealpoint_prox 
ln_full ln_pop sandler_strategic threat  terrorism_humancost nato_dummy years_nato years_nato_sq ln_troops
trade_us_gdp right dpi_checks isaf_troops_capita isaf_troops_gdp, by(countryname);

twoway (lfit isaf_troops_capita operating) 
(scatter isaf_troops_capita operating, msymbol(diamond) mcolor(navy) msize(medsmall) mlabsize(vsmall) mlabcolor(black) mlabel(countryname)),
xtitle("Operating Expenditures (%Milex)", size(medsmall) margin(medsmall))
ytitle("ISAF Troop Contribution (per thousand citizens)", size(medium) margin(medsmall))
legend(rows(2) size(vsmall) position(10) ring(0) label(1 Fitted) label(2 Observed))
note(r=0.54*, position(5) ring(0));
graph save output\Figure4_operating_isaf.gph, replace;
restore;
#delimit cr
